package com.gxitsky.config;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.mybatis.spring.SqlSessionFactoryBean;

import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;

/**
 * @author gxing
 * @desc TODO
 * @date 2023/8/13
 */
//public class SqlSessionFactoryUtil {
//
//    public static SqlSessionFactory factory = null;
//    public static InputStream is = null;
//
//    static {
//        try {
//            is = Resources.getResourceAsStream("config/mybatis-config.xml");
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//    }
//
//    public static SqlSessionFactory getSqlSessionFactory(){
//        if(Objects.isNull(factory)){
//            factory = new SqlSessionFactoryBuilder().build(is);
//        }
//        return factory;
//    }
//
//    public static SqlSession getSqlSession(){
//        return getSqlSessionFactory().openSession();
//    }
//}
